package com.jiazhong.example.example.rocket.demo1.alipay.controller;

import com.jiazhong.example.example.rocket.demo1.alipay.service.AlipayService;
import com.jiazhong.example.example.rocket.demo1.commons.bean.Alipay;
import com.jiazhong.example.example.rocket.demo1.commons.util.JsonResult;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
@Slf4j
@CrossOrigin
@RestController
@RequestMapping("/alipay")
public class AlipayController {
    @Resource
    private AlipayService alipayService;

    private Alipay alpay;

    @PostMapping("/pay")
    public String pay(Alipay alipay) {
        this.alpay = alipay;
        return alipayService.pay(alipay);
    }

    @GetMapping("/success")
    public JsonResult success() {
        return alipayService.query(this.alpay);
    }
}
